package shop.yaojianfeng.springlearning.section4.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import shop.yaojianfeng.springlearning.section4.entity.StudentInfo20;
import shop.yaojianfeng.springlearning.section4.service.StudentInfo20Service;

import java.util.List;

/**
 * 测试异步交互的控制器
 * @author yaojianfeng
 */
@RestController
@RequestMapping("/ajax")
public class AjaxTestController {
    @Autowired
    private StudentInfo20Service service;

    /**
     * 查询总数
     * @return
     */
    @RequestMapping("/queryCount")
    public int queryCount(){
        return service.queryCount();
    }

    /**
     * 根据名称进行查询
     * @return
     */
    @RequestMapping("/queryByName")
    public List<StudentInfo20> queryByName(StudentInfo20 info){
        return service.queryByName(info);
    }
}
